package com.un.ebs.workOrder.dto;

import com.un.ebs.core.util.SecurityUtils;
import com.un.ebs.workOrder.enums.RoleTypeEnum;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * <p>
 *  Add dto.
 * </p>
 *
 * @author liubo
 * @since 2019-11-18
 */
@Data
public class WorkOrderAddDto  {

    /**
     * 用于指示createRoleId是用户还是客户
     */
    @NotNull(message = "请指定当前的用户类型")
    private RoleTypeEnum createRoleType;

    @NotNull(message = "请指定当前用户ID，如果用户类别是客户则指定客户ID，如果用户是工作人员，请指定用户ID")
    private String createtRoleId;

    private String createRemark;

    @NotNull(message = "订单项ItemId不能为空")
    private String createOrderItemId;

    @Min(value = 1, message = "数量最小值为1。")
    @NotNull(message = "交付数量不能为空。")
    private Double itemQty;

    private Double itemPrice;

    private Date planCompleteTime;

    public WorkOrderAddDto() {

    }


    public WorkOrderAddDto(String itemId, String remark, Date planCompleteTime) {
        this.createOrderItemId = itemId;
        this.createRoleType = RoleTypeEnum.User;
        this.createtRoleId = SecurityUtils.getUserContent().getId();
        this.createRemark = remark;
        this.planCompleteTime = planCompleteTime;
    }

    public WorkOrderAddDto(String itemId, String roleId, RoleTypeEnum roleType, String remark, Date planCompleteTime) {
        this.createOrderItemId = itemId;
        this.createRoleType = roleType;
        this.createtRoleId = roleId;
        this.createRemark = remark;
        this.planCompleteTime = planCompleteTime;
    }

    public WorkOrderAddDto(String itemId, String roleId, RoleTypeEnum roleType, Double qty, Double price, String remark, Date planCompleteTime) {
        this.createOrderItemId = itemId;
        this.createRoleType = roleType;
        this.createtRoleId = roleId;
        this.itemQty = qty;
        this.itemPrice = price;
        this.createRemark = remark;
        this.planCompleteTime = planCompleteTime;
    }

}